package com.ilxqx.fierce.core;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 响应对象
 *
 * @author Venus
 * @since 1.0.0
 */
@Data
@AllArgsConstructor
public class FierceResponse {

    /**
     * 响应码
     */
    private Integer code;

    /**
     * 响应消息
     */
    private String message;

    /**
     * 响应数据
     */
    private Object data;

    public static FierceResponse create(Integer code, String message, Object data) {
        return new FierceResponse(code, message, data);
    }

    public static FierceResponse succeed(String message, Object data) {
        return new FierceResponse(0, message, data);
    }

    public static FierceResponse succeed(Object data) {
        return succeed("操作成功！", data);
    }

    public static FierceResponse succeed(String message) {
        return succeed(message, null);
    }

    public static FierceResponse fail(String message, Object data) {
        return new FierceResponse(1, message, data);
    }

    public static FierceResponse fail(String message) {
        return fail(message, null);
    }
}
